package com.battle.service.utils;

/**
 * @author anni.zhu
 * @author anni.zhu@king-v.com
 * Created in 2024/10/31 16:09
 */
public class StringPassUtil {

    public static String convertToSnakeCase(String input) {
        if (input == null || input.isEmpty()) {
            return input;
        }
        String result = input.replaceAll("([a-z])([A-Z]+)", "$1_$2").toLowerCase();
        return result;
    }

    public static void main(String[] args) {
        String camelCase = "idNumberCass";
        String snakeCase = convertToSnakeCase(camelCase);
        System.out.println(snakeCase); // Output: id_number
    }
}
